//ST*****************************************消息窗口组件*****************************************
/*
msgType:''    必须输入
msg:'',       消息内容
callback:''   回调函数
*/
RxMsgBox.msgType = {};
RxMsgBox.msgType.rxInfomation = "rxInfomation";
RxMsgBox.msgType.rxError = "rxError";
RxMsgBox.msgType.rxWarning = "rxWarning";
RxMsgBox.msgType.rxQuestion = "rxQuestion";

function RxMsgBox(msgType, msg, callback) {
    this.rxtype = "RxMsgBox";
    this.msgType = msgType;
    this.msg = msg;
    this.callback = callback;

    this.label = RxLabel.init(this.msgType + "_rx_msg_box_text", this.msg);
    var msgSize = RxCommon.getTextSize(this.label, this.msg);
    var width = 0;
    if (msgSize.width > 200) {
        width = msgSize.width + 40;
    }

    if (msgType == RxMsgBox.msgType.rxInfomation) {
        this.dialog = new RxDialog({id:msgType, title:"信息", width:(width>0?width:null), buttons:{data:[{type:'ok', text:'确定'}]}}, this.buttonClick);
    } else if (msgType == RxMsgBox.msgType.rxError) {
        this.dialog = new RxDialog({id:msgType, title:"错误", width:(width>0?width:null), buttons:{data:[{type:'ok', text:'确定'}]}}, this.buttonClick);
    } else if (msgType == RxMsgBox.msgType.rxWarning) {
        this.dialog = new RxDialog({id:msgType, title:"警告", width:(width>0?width:null), buttons:{data:[{type:'ok', text:'确定'}]}}, this.buttonClick);
    } else if (msgType == RxMsgBox.msgType.rxQuestion) {
        this.dialog = new RxDialog({id:msgType, title:"询问", width:(width>0?width:null), buttons:{data:[{type:'cancel', text:'关闭'},{type:'ok', text:'确定'}]}}, this.buttonClick);
    }
    this.dialog.self = this;

    this.init();
}

RxMsgBox.prototype = {
    init: function() {
        //var label = RxLabel.init(this.msgType + "_rx_msg_box_text", this.msg);
        this.dialog.add(this.label, {top:"5px", left:"0px", width:"100%", textAlign:"center"});
        this.dialog.show();
    },
    buttonClick: function(data) {
        var result = data;
        if (!result && this.iframe) {
            result = this.getPageData();
        }
        return this.self.callback(result);
    }
};
//ED*****************************************消息窗口组件*****************************************
